home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
gt_power
/
gtuser11.zip
/
GTUSERTS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-11-12
|
4KB
|
143 lines
program GTUserTest;
{ Simple program to test and demonstrate operation of 'GTUSER' unit - which
allows easy access to the contents of GT-PowerComm's GTUSER.BBS door
program information file for Turbo Pascal programmers.
}
uses
CRT,
GTUSER;
var
User_Details : GTUSER_BBS_Details;
Quit_Char : string;
procedure Display_Authorisations(AS : Authorisation_Set);
{ Sample of how to check and display current user's authorisations. In a
"real" application, you could code something like :
Allow_shell_to_DOS := (SY in AS) or (SH in AS);
}
const
Num_Auths = 16;
AU_Val : array[1..Num_Auths] of Authorisations =
( UP , DN , PR , KL , SY , CH , SH , DR , MS , FA ,
FR , NL , NE , CB , NP , DX);
AU_Desc : array[1..Num_Auths] of string [79] =
('UP : Uploads permitted',
'DN : Downloads permitted',
'PR : You may enter private mail',
'KL : You can K)ill messages like sysop',
'SY : As SYSOP, you are omnipotent!',
'CH : Manual dir. change allowed (if GTDIR.BBS not in use)',
'SH : Shell to DOS allowed',
'DR : Use of DOORs is permitted',
'MS : You may read messages',
'FA : You are allowed to FileAttach when netmailing',
'FR : You are allowed to FileRequest when netmailing',
'NL : L)ist directory main menu option disabled',
'NE : You may NOT Enter messages',
'CB : CB simulator may be used',
'NP : Sysop page disabled',
'DX : Delivery authorised');
var
i : byte;
begin
{ This is a neat way to display values of enumerated data types }
for i := 1 to Num_Auths
do
if AU_Val[i] in AS
then
writeln('':5,AU_Desc[i])
end; { Display_Authorisations }
procedure Zero_Fill(var s : string);
{ Turns all blanks in 's' to zeros }
var
i : byte;
begin
for i := 1 to length(s)
do
if s[i] = ' '
then
s[i] := '0'
end; { Zero_Fill }
function Date_To_Str(Date : GTUSER_Date_Type) : string;
{ Display a date from GTUSER }
var
Build_Str, Temp_Str : string;
begin
Str(Date.DD:2,Build_Str);
Str(Date.MM:2,Temp_Str);
Build_Str := Build_Str + '/' + Temp_str;
Str(Date.YYYY:4,Temp_Str);
Build_Str := Build_Str + '/' + Temp_str;
Zero_Fill(Build_Str);
Date_To_Str := Build_Str
end; { Date_To_Str }
function Time_To_Str(Time : GTUSER_Time_Type) : string;
{ Display a time from GTUSER }
var
Build_Str, Temp_Str : string;
begin
Str(Time.HH:2,Build_Str);
Str(Time.MM:2,Temp_Str);
Build_Str := Build_Str+':'+Temp_str;
Str(Time.SS:2,Temp_Str);
Build_Str := Build_Str+':'+Temp_str;
Zero_Fill(Build_Str);
Time_To_Str := Build_Str
end; { Time_To_Str }
procedure DisplayUserDetails(UD : GTUSER_BBS_Details);
{ Pretty useless demo procedure to show extraction of information from
record generated by GTUSER unit }
begin
clrscr;
writeln('Current (or most recent) user details :');
writeln;
writeln('Level : ',UD.Level);
writeln('Name : ',UD.First_name,' ',UD.Last_name);
writeln;
writeln('Authorisations : ');
Display_Authorisations(UD.Authorisation);
writeln;
write ('Communication Rate : ');
if UD.DCE_Baud = 0
then writeln('N/A (local test call)')
else writeln('DCE = ',UD.DCE_Baud,' bps, DTE = ',UD.DTE_Baud,' bps');
write ('ANSI : ');
if UD.ANSI_Opt
then writeln('Yes')
else writeln('No');
writeln('Last on (DD/MM/YYYY): ',Date_To_Str(UD.Date_Last_On));
writeln('Remaining this call : ',UD.Limit:5,' min ');
writeln('Next "event" in : ',UD.Event:5,' min ');
writeln('GTUSER.BBS time is : ',Time_To_Str(UD.Current_Time));
end; { User_Details }
begin
DirectVideo := false;
Quit_Char := '';
repeat
GetGTUSERDetails(User_Details);
DisplayUserDetails(User_Details);
writeln;
write('Press <ENTER> to refresh details, or enter "Q" to exit ');
readln(Quit_Char)
until ((length(Quit_char) > 0) and (upcase(Quit_Char[1]) = 'Q'));
end.